<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>testAjax</title>
  <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
  <button id="btn1" type="button" name="button">获得外部内容</button>
  <div id="div1"></div>
  <script>
    $(function(){
      $('#btn1').click(function(){
        $('#div1').load("testAjax/test.txt",function(responseTxt, statusTxt,xhr){
          if(statusTxt=="success")alert("success");
          if(statusTxt=="error")alert("error");
        });
      });
    });
  </script>
</body>
</html>
